package com.xxwy.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.context.Lifecycle;

/**
 * @author wy
 * @date 2020/4/21 10:37
 */
@Data
@AllArgsConstructor
public class User implements Lifecycle {
  private String name;
  private Integer age;

  private boolean running = false;

  public User(String name, Integer age) {
    this.name = name;
    this.age = age;
    System.out.println(name + "-user-实例化");
  }

  public User() {
    System.out.println("user-实例化");
  }

  public static User createUser(){
    return new User("method",2, false);
  }

  @Override
  public void start() {
    System.out.println(" user lifecycle start");
  }

  @Override
  public void stop() {
    System.out.println(" user lifecycle stop");
  }

  @Override
  public boolean isRunning() {
    return running;
  }
}
